
{block name="style"}
<link rel="stylesheet" href="{__CSS__}/user.css?v={:get_system_config('web','version')}" media="all">
<link rel="stylesheet" href="{__STATIC__}/assets/gougu/css/gougu.css" media="all">
<link rel="stylesheet" href="{__STATIC__}/assets/layui/css/layui.css" media="all">
{/block}
<!-- 主体 -->
{block name="body"}
<div class="layui-layer layui-layer-page" id="layui-layer1" type="page" times="1" showtime="0" contype="string" style="z-index: 19891015; width: 640px; height: 460px; position: fixed; top: 371px; left: 604.5px;"><div class="layui-layer-title" style="cursor: move;">批量导入学生</div><div class="layui-layer-content" style="height: 409px;">
	<div class="layui-form p-3">
	<form action="{:url('/api/import/import_student')}" method="post" enctype="multipart/form-data">

<p>要上传的文件１<input type="file" name="file"/></p>
<p><input type="submit" value="提交" /></p>
</form>
	<div id="uploadType1">
		<div class="layui-form-item">
			<label class="layui-form-label">文件：</label>
			<div class="layui-input-block">
				<span class="gougu-upload-files">.xls,.xlsx</span>
			    <button type="button" class="layui-btn layui-btn-normal" id="uploadSelect">选择文件</button>
			<input class="layui-upload-file" type="file" accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" name="file"><a href="/static/file/学生导入模板.xlsx" class="layui-btn ml-4">Execl表格模板下载</a>	
		   </div>
    	</div>
	<div class="layui-form-item">
			<label class="layui-form-label"></label>
			<div class="layui-input-block">
				<span class="gougu-upload-tips">
					1、只有超级管理员才能进行批量导入操作；<br>
					2、只能上传 .xls、.xlsx文件；<br>
					3、数据请勿放在合并的单元格中；<br>
					4、文件大小请勿超过2MB，导入数据不能超过3000条<br>
				5、如果导入失败，请注意检查表格数据，格式按照样本填写，班级、课程需要系统中存在，不存在的话可能会导入失败。</span>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"></label>								
		    <div class="layui-input-block green" id="gougu-upload-choosed"></div>
	    </div>							
		<div class="layui-form-item">
			<label class="layui-form-label"></label>								
			<div class="layui-input-block red" id="gougu-upload-note"></div>
			</div>
			<div class="layui-form-item layui-form-item-sm">
				<label class="layui-form-label"></label>
	<div class="layui-input-block">	
	<button type="button" class="layui-btn" id="uploadAjax">上传并导入</button>
   </div>
   </div>	
	</div> 
</div>
</div>
<div class="layui-layer-setwin">
<span class="layui-icon layui-icon-close layui-layer-close layui-layer-close1"></span>
</div>
<span class="layui-layer-resize"></span>
</div>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}

<script src="{__STATIC__}/assets/layui/layui.js"></script>
<script>
     layui.use(['upload','form'], function(){ 
        var upload = layui.upload;
        var form = layui.form;
        upload.render({
            elem: '#uploadSelect', 			//选中你要绑定的上传组件
            url: '/api/import/import_student',//上传接口
            accept:'file',					//文件类型，不写默认是images，file表示全类型
            done: function(res){		//上传完回调，这里的res必须是json类型
                if (res.status === 200) {
                    layer.msg(res.msg, {icon: 1});
                    $('#gougu-upload-note').html(res.path);  //回填路径值
                }else{``
                    layer.msg('上传失败', {icon: 2});
                }
            },
            error: function(){
                layer.msg('error'+ res.status, {icon: 2});
            }
        });
    });

</script>
{/block}
<!-- /脚本 -->